home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
penguin_dinner.swf
/
scripts
/
__Packages
/
classes
/
game
/
CharActionQueue.as
next >
Wrap
Text File
|
2008-03-17
|
1KB
|
40 lines
class classes.game.CharActionQueue
{
function CharActionQueue()
{
}
function setTargetTile($initTile, $targetTile, $speed)
{
var _loc8_ = new classes.math.AStarPathfinder();
var _loc3_ = _loc8_.getOptimizedPath($initTile,$targetTile);
_loc3_.reverse();
var _loc4_ = [];
var _loc5_ = [];
var _loc6_ = _loc3_.length;
var _loc2_ = 0;
while(_loc2_ < _loc6_)
{
_loc4_.push((_loc3_[_loc2_].x + classes.math.Tile.DX) * classes.math.Tile.SIZE + 10);
_loc5_.push((_loc3_[_loc2_].y + classes.math.Tile.DY) * classes.math.Tile.SIZE + 10);
_loc2_ = _loc2_ + 1;
}
var _loc7_ = new classes.math.CatmullRomSpline(_loc4_,_loc5_);
this.pathQueue = _loc7_.getAllPoints($speed);
}
function getCoords()
{
var _loc2_ = this.pathQueue.shift();
if(this.pathQueue.length > 0)
{
_loc2_.end = false;
_loc2_.dx = this.pathQueue[0].x - _loc2_.x;
_loc2_.dy = this.pathQueue[0].y - _loc2_.y;
}
else
{
_loc2_.end = true;
}
return _loc2_;
}
}